package com.zhuss.black.black;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.zhuss.bean.bo.black.black.CreateBlackBo;
import com.zhuss.bean.bo.black.black.DeleteBlackBo;
import com.zhuss.bean.bo.black.black.UpdateBlackBo;
import com.zhuss.bean.bo.black.black.wechat.CollectBlackBo;
import com.zhuss.bean.bo.black.black.wechat.DelTopicBlackBo;
import com.zhuss.bean.bo.black.black.wechat.ForwardBlackBo;
import com.zhuss.bean.bo.black.black.wechat.ThumbBlackBo;
import com.zhuss.bean.bo.black.black.wechat.TopicBlackBo;
import com.zhuss.common.OperateService;
import com.zhuss.common.Processor;
import com.zhuss.exception.WpsException;

/**
 * black操作service（基本操作）
 * @author zhushanshuo
 * @Date 2020-02-05 15:59
 *
 */
@Component("blackOperateService")
public class BlackOperateService implements OperateService<Void, Object> {
	
	@Autowired
	@Qualifier("blackCreate")
	private Processor<Object, CreateBlackBo> blackCreate;
	
	@Autowired
	@Qualifier("blackUpdate")
	private Processor<Object, UpdateBlackBo> blackUpdate;
	
	@Autowired
	@Qualifier("blackDelete")
	private Processor<Object, DeleteBlackBo> blackDelete;
	
	@Autowired
	@Qualifier("blackThumb")
	private Processor<Object, ThumbBlackBo> blackThumb;
	
	@Autowired
	@Qualifier("blackCollect")
	private Processor<Object, CollectBlackBo> blackCollect;
	
	@Autowired
	@Qualifier("blackForward")
	private Processor<Object, ForwardBlackBo> blackForward;
	
	@Autowired
	@Qualifier("blackTopic")
	private Processor<Object, TopicBlackBo> blackTopic;
	
	@Autowired
	@Qualifier("blackDelThumb")
	private Processor<Object, ThumbBlackBo> blackDelThumb;
	
	@Autowired
	@Qualifier("blackDelCollect")
	private Processor<Object, CollectBlackBo> blackDelCollect;
	
	@Autowired
	@Qualifier("blackDelForward")
	private Processor<Object, ForwardBlackBo> blackDelForward;
	
	@Autowired
	@Qualifier("blackDelTopic")
	private Processor<Object, DelTopicBlackBo> blackDelTopic;
	
	/**
	 * 创建
	 */
	@Override
    @Transactional(rollbackFor = Exception.class)
	public Void create(Object param) throws WpsException {
		
		CreateBlackBo bo = (CreateBlackBo) param;
		
		blackCreate.process(bo);
		
		return null;
	}
    
	/**
	 * 修改
	 */
	@Override
    @Transactional(rollbackFor = Exception.class)
    public Void update(Object param) throws WpsException {
    	
		UpdateBlackBo bo = (UpdateBlackBo) param;
		
		blackUpdate.process(bo);
		
    	return null;
    }
	
	/**
	 * 删除
	 */
	@Override
	@Transactional(rollbackFor = Exception.class)
	public Void delete(Object param) throws WpsException {
		
		DeleteBlackBo bo = (DeleteBlackBo) param;
		
		blackDelete.process(bo);
		
		return null;
	}
	
	/**
	 * 点赞
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void thumb(Object param) throws WpsException {
		
		ThumbBlackBo bo = (ThumbBlackBo) param;
		
		blackThumb.process(bo);
		
		return null;
	}
	
	/**
	 * 收藏
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void collect(Object param) throws WpsException {
		
		CollectBlackBo bo = (CollectBlackBo) param;
		
		blackCollect.process(bo);
		
		return null;
	}
	
	/**
	 * 转发
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void forward(Object param) throws WpsException {
		
		ForwardBlackBo bo = (ForwardBlackBo) param;
		
		blackForward.process(bo);
		
		return null;
	}
	
	/**
	 * 评论
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void topic(Object param) throws WpsException {
		
		TopicBlackBo bo = (TopicBlackBo) param;
		
		blackTopic.process(bo);
		
		return null;
	}
	
	/**
	 * 取消
	 * 点赞
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void delThumb(Object param) throws WpsException {
		
		ThumbBlackBo bo = (ThumbBlackBo) param;
		
		blackDelThumb.process(bo);
		
		return null;
	}
	
	/**
	 * 取消
	 * 收藏
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void delCollect(Object param) throws WpsException {
		
		CollectBlackBo bo = (CollectBlackBo) param;
		
		blackDelCollect.process(bo);
		
		return null;
	}
	
	/**
	 * 取消
	 * 转发
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void delForward(Object param) throws WpsException {
		
		ForwardBlackBo bo = (ForwardBlackBo) param;
		
		blackDelForward.process(bo);
		
		return null;
	}
	
	/**
	 * 删
	 * 评论
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void delTopic(Object param) throws WpsException {
		
		DelTopicBlackBo bo = (DelTopicBlackBo) param;
		
		blackDelTopic.process(bo);
		
		return null;
	}
	
}

